//
//  SecendViewController.m
//  testCocoPods1.0
//
//  Created by ChenJs92 on 16/11/15.
//  Copyright © 2016年 chenjs92. All rights reserved.
//

#import "SecendViewController.h"
#import "MVSecendScrollView.h"
#import "MVSecendScrooViewMode.h"
#import "MVCircleListViewController.h"
#import "showImageViewController.h"
@interface SecendViewController ()
@property (strong, nonatomic) MVSecendScrollView *mainView;
@property (strong, nonatomic) MVSecendScrooViewMode *viewModel;

@end

@implementation SecendViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
-(void)updateViewConstraints{
//    WS(weakSelf)
    [self.mainView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.edges.mas_equalTo(weakSelf.view);
        make.left.top.right.bottom.mas_equalTo(0);
        
    }];
    [super updateViewConstraints];
}
-(void)yd_addSubviews{
    [self.view addSubview:self.mainView];
}
-(void)yd_bindViewModel{
//    @weakify(self);
    [[self.viewModel.banarClickSubject takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
//        @strongify(self);
        //点击banar事件
    }];
    
    [[self.viewModel.actiClickSubject takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
        //        @strongify(self);
        //点击分类事件
        showImageViewController *fc = [[showImageViewController alloc] init];
        [self.navigationController pushViewController:fc animated:YES];
        NSLog(@"点击了分类事件 传回值 %@-----",x);
    }];
    
    [[self.viewModel.goodsClickSubject takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
        //        @strongify(self);
        //点击商品事件
    }];
}
-(void)yd_layoutNavigation{
    self.title = @"wecome 二大爷";
}
-(MVSecendScrollView *)mainView{
    if (!_mainView) {
        _mainView = [[MVSecendScrollView alloc] initWithViewModel:self.viewModel];
    }
    return _mainView;
}
-(MVSecendScrooViewMode *)viewModel{
    if (!_viewModel) {
        _viewModel = [[MVSecendScrooViewMode alloc] init];
    }
    return _viewModel;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
